From 247ea53d9ba8e686890d42f3e4166d1fac6e3029 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Wed, 23 Oct 2013 03:37:25 +0000 Subject: [PATCH] Rollback two formats where I introduced a regression in the non-NEW_STRINGS case svn merge -r4639:4637 stmwpp.cc mmo.cc git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4641 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/mmo.cc | 44 ++++++++++---------------------------------- gpsbabel/stmwpp.cc | 9 +++------ 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/gpsbabel/mmo.cc b/gpsbabel/mmo.cc index c0edb8131..3522ac011 100644 --- a/gpsbabel/mmo.cc +++ b/gpsbabel/mmo.cc @@ -461,11 +461,8 @@ mmo_read_CObjWaypoint(mmo_data_t* data) data->name, data->visible ? "yes" : "NO", data->objid)); data->data = wpt = waypt_new(); -#if NEW_STRINGS - wpt->shortname = QString::fromLatin1(data->name); -#else wpt->shortname = xstrdup(data->name); -#endif + time = data->mtime; if (! time) { time = data->ctime; @@ -524,11 +521,7 @@ mmo_read_CObjWaypoint(mmo_data_t* data) } if (*cend++) { -#if NEW_STRINGS - wpt->notes = QString::fromLatin1(cend); -#else wpt->notes = xstrdup(cend); -#endif } if (wpt->HasUrlLink()) { @@ -538,12 +531,9 @@ mmo_read_CObjWaypoint(mmo_data_t* data) wpt->notes = xstrdup(str); } xfree(str); -#if NEW_STRINGS - if (!wpt->notes.isEmpty()) { -#else + if (wpt->notes) { -#endif - DBG((sobj, "notes = \"%s\"\n", CSTRc(wpt->notes))); + DBG((sobj, "notes = \"%s\"\n", wpt->notes)); } mmo_fillbuf(buf, 12, 1); @@ -990,20 +980,15 @@ mmo_finalize_rtept_cb(const waypoint* wptref) wpt->latitude = wpt2->latitude; wpt->longitude = wpt2->longitude; -#if NEW_STRINGS - wpt->shortname = wpt2->shortname; - wpt->description = wpt2->description; - wpt->notes = wpt2->notes; -#else xfree(wpt->shortname); wpt->shortname = xstrdup(wpt2->shortname); + if (wpt2->description) { wpt->description = xstrdup(wpt2->description); } if (wpt2->notes) { wpt->notes = xstrdup(wpt2->notes); } -#endif if (wpt2->HasUrlLink()) { UrlLink l = wpt2->GetUrlLink(); wpt->notes = xstrdup(l.url_.toUtf8().data()); @@ -1252,7 +1237,7 @@ mmo_write_obj_head(const char* sobj, const char* name, const time_t ctime, static void mmo_write_wpt_cb(const waypoint* wpt) { - char* str; + char* str, *cx; int objid; time_t time; int icon = 0; @@ -1280,11 +1265,7 @@ mmo_write_wpt_cb(const waypoint* wpt) DBG(("write", "waypoint \"%s\"\n", wpt->shortname ? wpt->shortname : "Mark")); objid = mmo_write_obj_head("CObjWaypoint", -#if NEW_STRINGS - wpt->shortname.isEmpty() ? "Mark" : CSTRc(wpt->shortname), time, obj_type_wpt); -#else (wpt->shortname && *wpt->shortname) ? CSTRc(wpt->shortname) : "Mark", time, obj_type_wpt); -#endif data = mmo_register_object(objid, wpt, wptdata); data->refct = 1; mmo_write_category("CCategory", (mmo_datatype == rtedata) ? "Waypoints" : "Marks"); @@ -1309,7 +1290,7 @@ mmo_write_wpt_cb(const waypoint* wpt) str = xstrdup(""); } - QString cx = wpt->notes; + cx = wpt->notes; if (cx == NULL) { cx = wpt->description; } @@ -1323,7 +1304,7 @@ mmo_write_wpt_cb(const waypoint* wpt) tmp.is_html = 1; cx = kml = strip_html(&tmp); } - str = xstrappend(str, CSTR(cx)); + str = xstrappend(str, cx); if (kml) { xfree(kml); } @@ -1381,11 +1362,7 @@ mmo_write_rte_head_cb(const route_head* rte) } objid = mmo_write_obj_head("CObjRoute", -#if NEW_STRINGS - rte->rte_name.isEmpty() ? "Route" : CSTRc(rte->rte_name), time, obj_type_rte); -#else (rte->rte_name && *rte->rte_name) ? CSTRc(rte->rte_name) : "Route", time, obj_type_rte); -#endif mmo_register_object(objid, rte, rtedata); mmo_write_category("CCategory", "Route"); gbfputc(0, fout); /* unknown */ @@ -1436,11 +1413,7 @@ mmo_write_trk_head_cb(const route_head* trk) } objid = mmo_write_obj_head("CObjTrack", -#if NEW_STRINGS - trk->rte_name.isEmpty() ? "Track" : CSTRc(trk->rte_name), gpsbabel_time, obj_type_trk); -#else (trk->rte_name && *trk->rte_name) ? CSTRc(trk->rte_name) : "Track", gpsbabel_time, obj_type_trk); -#endif mmo_write_category("CCategory", "Track"); gbfputuint16(trk->rte_waypt_ct, fout); @@ -1545,6 +1518,7 @@ mmo_write(void) track_disp_all(mmo_write_trk_head_cb, mmo_write_trk_tail_cb, mmo_write_wpt_cb); } +/**************************************************************************/ ff_vecs_t mmo_vecs = { ff_type_file, @@ -1560,3 +1534,5 @@ ff_vecs_t mmo_vecs = { CET_CHARSET_MS_ANSI, 0 }; + +/**************************************************************************/ diff --git a/gpsbabel/stmwpp.cc b/gpsbabel/stmwpp.cc index e551c7aac..303a2cdbb 100644 --- a/gpsbabel/stmwpp.cc +++ b/gpsbabel/stmwpp.cc @@ -135,11 +135,7 @@ stmwpp_data_read(void) break; case 2: -#if NEW_STRINGS - wpt->shortname = QString::fromLatin1(c); -#else wpt->shortname = xstrdup(c); -#endif break; case 3: @@ -250,8 +246,8 @@ stmwpp_waypt_cb(const waypoint* wpt) snprintf(cdate, sizeof(cdate), "%02d/%02d/%04d", tm.tm_mon, tm.tm_mday, tm.tm_year); snprintf(ctime, sizeof(ctime), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec); - QString sn; switch (what) { + char* sn; case STM_WAYPT: case STM_RTEPT: @@ -260,7 +256,8 @@ stmwpp_waypt_cb(const waypoint* wpt) } else { sn = mkshort(short_h, wpt->shortname); } - gbfprintf(fout, "WP,D,%s,", CSTR(sn)); + gbfprintf(fout, "WP,D,%s,", sn); + xfree(sn); break; case STM_TRKPT: -- 2.30.2